TreeGrid Cells Tutorial
9. Cell Events, Menu, Tip, Hint and Custom dialogs
Cell API and XML events, popup Menu, tooltip, Hint and showing custom dialogs by API
-
Menu
attribute defines popup menu shown on right click to the cell or row.
The menu can be defined as first character separated array or by complete TreeGrid JSON menu definition.
The selected item can be got in API event OnContextMenu or in the JSON menu events OnSave or OnClick.
The popup menu can be also shown by custom way by method API ShowPopup or ShowMenu in any event handler like OnRightClick.
-
Tip
attribute defines tooltip for the cell, or for cell part like side button or panel icon.
There can be also defined more tooltips for particular cell value (e.g. for button on/off).
The tip content supports any HTML code including images or more lines.
Is possible also predefine tooltip position where it will be shown by TipPosition attribute.
When the Tip attribute is 1, it shows actual cell value as tooltip.
The tooltip content can be also created dynamically in API event OnTip.
Hint
is feature that shows the whole content of overflowed cell as popup directly above the cell.
It is turn on by default for all cell types except Radio, Gantt, Chart, Abs and Icon and can be also disabled by ShowHint='0'.
The text shown can be dynamically changed or created by API event OnHint.
Custom dialog
like calendar can be defined in this way:
-
Define the XML event (in cell or column) for click to the button, for calendar it is OnClickSideDate, for defaults OnClickSideDefaults and for custom Button/Icon OnClickSideButton or OnClickSideIcon.
This event has four parameters: Grid, Row, Col, Event, the event contains also the position of mouse click.
-
In this event handler show the custom dialog on given position, for the cell or on mouse click position.
-
Close any previous dialog in grid by Grid.CloseDialog();
-
Optionally finish editing by Grid.EndEdit(1); or cancel editing by Grid.EndEdit(0);
-
The created dialog object (or any other custom object) assign to Grid.Dialog property.
This object should define its Close method that is called by grid when the dialog should be closed on demand (for example if a user clicks to another cell).
For example: Grid.Dialog = { Close:function(){ CloseMyDialog(); } }